﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:Resources.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Resources;component/Styles/MenuStyle.xaml"/>
        <!--总颜色样式定义-->
        <ResourceDictionary Source="./Themes/Colors.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!--正常按钮磁铁-->
    <Style x:Key="NormalTile" TargetType="Controls:Tile">
        <Setter Property="Margin" Value="3" />
        <Setter Property="Foreground" Value="{StaticResource bg_text}" />
        <Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:Tile">
                    <Grid Background="{TemplateBinding Background}">
                        <StackPanel>
                            <ContentPresenter RecognizesAccessKey="True" />
                            <Grid Height="12">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="30"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="20"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Right" VerticalAlignment="Top" Foreground="{TemplateBinding Foreground}" TextWrapping="NoWrap" FontSize="{TemplateBinding FontSize}" Grid.Column="0" />
                                <TextBlock Text="{TemplateBinding Count}" FontSize="{TemplateBinding CountFontSize}" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="2" />
                            </Grid>
                        </StackPanel>
                        <Border x:Name="border" BorderBrush="Transparent" BorderThickness="2"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button.IsPressed" Value="True">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="0.98"
                                                    ScaleY="0.98"
                                                    CenterX="0.5"
                                                    CenterY="0.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="Button.IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="#FF3399FF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--图标+文字按钮样式-->
    <Style x:Key="PicBtnStyle" TargetType="Controls:PicBtn">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Foreground" Value="{StaticResource bg_text}"/>
        <Setter Property="MinHeight" Value="25"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:PicBtn">
                    <Grid Background="{TemplateBinding Background}">
                        <StackPanel Orientation="Horizontal">
                            <ContentPresenter x:Name="contentPresenter" Margin="5,0" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                            <TextBlock Text="{TemplateBinding Title}" Margin="0" FontSize="{TemplateBinding FontSize}" VerticalAlignment="Center"/>
                        </StackPanel>
                        <Border x:Name="border" BorderBrush="Transparent" BorderThickness="1"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True"/>
                        <Trigger Property="IsDefaulted" Value="True"/>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="#FF3399FF"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="0.98"
                                                    ScaleY="0.98"
                                                    CenterX="0.5"
                                                    CenterY="0.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False"/>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--我的游戏 磁铁-->
    <Style x:Key="MyGameTitleStyle" TargetType="Controls:GameTile">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Foreground" Value="{StaticResource bg_text}"/>
        <Setter Property="Margin" Value="5,5,0,0"/>
        <Setter Property="ContextMenu">
            <Setter.Value>
                <ContextMenu Style="{StaticResource ContextMenuStyle}">
                    <MenuItem Header="置顶"  Style="{StaticResource MenuItemStyle}"/>
                    <MenuItem Header="删除"  Style="{StaticResource MenuItemStyle}"/>
                </ContextMenu>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:GameTile">
                    <Border x:Name="border" BorderBrush="{StaticResource border}" BorderThickness="1" CornerRadius="2">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Image Grid.Row="0" Grid.RowSpan="2" Source="{TemplateBinding ImgSource}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
                            <Border x:Name="border1" Grid.Row="1" Background="{TemplateBinding Background}" Opacity="0.8" Height="{TemplateBinding TitleHeight}" Width="{TemplateBinding Width}" VerticalAlignment="Bottom">
                                <TextBlock x:Name="title" Margin="{TemplateBinding TitleMargin}" Text="{TemplateBinding Title}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True"/>
                        <Trigger Property="IsDefaulted" Value="True"/>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" TargetName="title" Value="{StaticResource bg_text}"/>
                            <Setter Property="Background" TargetName="border1" Value="{StaticResource mouseover_bg}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="0.98"
                                                    ScaleY="0.98"
                                                    CenterX="0.5"
                                                    CenterY="0.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False"/>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--所有游戏 磁铁-->
    <Style x:Key="AllGameTitleStyle" TargetType="Controls:GameTile">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Foreground" Value="{StaticResource pop_bg_text}"/>
        <Setter Property="Margin" Value="5,5,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:GameTile">
                    <Border x:Name="border" BorderBrush="{StaticResource border}" BorderThickness="1" CornerRadius="2">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Image Grid.Row="0" Grid.RowSpan="2" Stretch="Fill" Source="{TemplateBinding ImgSource}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
                            <Border x:Name="border1" Grid.Row="1" Background="{TemplateBinding Background}" Opacity="0.8" Height="{TemplateBinding TitleHeight}" Width="{TemplateBinding Width}" VerticalAlignment="Bottom">
                                <TextBlock x:Name="title" Margin="{TemplateBinding TitleMargin}" Text="{TemplateBinding Title}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True"/>
                        <Trigger Property="IsDefaulted" Value="True"/>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" TargetName="title" Value="{StaticResource bg_text}"/>
                            <Setter Property="Background" TargetName="border1" Value="{StaticResource mouseover_bg}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="0.98"
                                                    ScaleY="0.98"
                                                    CenterX="0.5"
                                                    CenterY="0.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False"/>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>